Repository navigation
Conversation
Wkhanex
left a comment
There was a problem hiding this comment.
AI-assisted validation at 386786c7a48c on Python 3.12.14: I checked basic/literal and single/multiline strings with backslashes, a tab, Unicode text, and ordinary text. With escaping enabled, all 16 combinations round-tripped through tomllib with their input value intact. For multiline strings beginning with one or two LFs, I separately verified that escape=False emits the supplied body verbatim, while the default mode adds the trim-protection newline. The 79 string-focused API/item tests passed.
That separation is the behavior I would preserve in regression coverage: verbatim mode may intentionally give a parsed value different from the raw body because TOML trims an opening newline. It should not silently gain the extra newline needed by the default value-preserving mode.
This PR streamlines the control flow of
String.from_raw, fixing #655, and improves the documentation ofstring(..., escape=False).